﻿<?php include $this->admin_tpl('meta');?>
<title>添加<?php echo $diy_list['name'];?>记录</title>
</head>
<body>
<article class="page-container">
<div class="formdoby_normal"> 
	<form method="post" onsubmit="return dosub(this)">
	<input type="hidden" name="id" value="<?php echo $data['id'];?>" class="input-text w_300">
	<div class="tabCon formdoby_info" style="display: block;">
		<div class="yzm-table-box">
		<table width="100%" class="table table-border yzmcms_table">
			<tbody>
			<?php foreach($field as $k=>$v){
				if(isset($v['is_switch'])&&$v['is_switch']==true){
			?>
			<tr>
				<td width="120"><span class="c-red">*</span><?php echo $v['title'];?>：</td> 
				<td>
					<span class="span_input">
						<label class="label_radio"><input name="<?php echo $k;?>" type="radio" value="是" <?php if($data['field']=='是'){?>checked="1"<?php } ?>> 是</label>
						<label class="label_radio"><input name="<?php echo $k;?>" type="radio" value="否" <?php if($data['field']=='否'){?>checked="1"<?php } ?>> 否</label>
					</span>
				</td>
			</tr>
			<?php }else{?>
			<tr>
				<td width="120"><span class="c-red">*</span><?php echo $v['title'];?>：</td> 
				<td>
				<input type="text" name="<?php echo $k;?>" autocomplete="off" value="<?php echo $data['shop_name'];?>" class="input-text" placeholder="请输入<?php echo $v['title'];?>">
				</td>
			</tr>
			<?php }}?>
			</tbody>
		</table>
		</div>
	
	</div>
	<div class="footer_btn">
		<input type="hidden" name="dosubmit" value="1">
		<input class="btn btn-primary radius" type="submit" value="提 交">
		<input class="btn btn-default radius" type="button" value="取 消" onclick="yzmcms_close()">	
	</div>
	</form>
</div>
</article>
<?php include $this->admin_tpl('footer');?>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/layui/layui.js"></script>
<script type="text/javascript">
function dosub(obj){
	$.ajax({
		type: 'POST',
		url: '<?php echo U('diy_list',['type'=>$type,'action'=>'add']);?>', 
		data: $(obj).serialize(),
		dataType: "json", 
		success: function (msg) {
			if(msg.status == 1){
				layer.msg(msg.message, {icon:1, time:800}, function(){
					parent.table.reload('table');
					var index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe 层的索引
					parent.layer.close(index); // 再执行关闭
				});
			}else{
				layer.msg(msg.message, {icon:2});
			}
		}
	})		 
	return false;			 
}
</script> 

</body>
</html>